package mysql

import (
	"errors"
	"gorm.io/gorm"
	"hotel-app/common/proto/hotel"
	"hotel-app/cont"
)

type User struct {
	gorm.Model
	Mobile string `gorm:"type:char(11);not null;unique;" json:"mobile"`
}

func (u *User) FindUserByMobile(in *hotel.UserLoginReq) (*User, error) {
	err := cont.DB.Where("mobile=?", in.Mobile).Find(&u).Error
	if err != nil {
		return nil, errors.New("查询失败")
	}
	return u, nil

}
